#!/usr/bin/ruby

# Example 3 - Read File with Exception Handling
counter = 1
begin
   file = File.new("sample.plan", "r")
   while (line = file.gets)
      #puts "#{counter}: #{line}"
      #counter = counter + 1
      if /^===/.match(line) 
         puts "found an iteration: " << line
         end
      if /^==/.match(line)
         puts "found a day" << line
         end
      if /\s@\s/.match(line)
         puts "found a todo" << line
         end
      if /\s@\s/.match(line)
         puts "found a in progress" << line
         end
      if /\sx\s/.match(line)
         puts "found a done" << line
         end
      if /\sx\s/.match(line)
         puts "found a done" << line
         end
      end
      file.close
rescue => err
   puts "Exception: #{err}"
   err
end

